package cn.cvs.service.impl;

import cn.cvs.mapper.supplier.SupplierMapper;
import cn.cvs.pojo.Supplier;
import cn.cvs.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: 邓必宏
 * @title:
 * @Demo:
 * @DateTime: 2023/10/27
 */

@Transactional
@Service("supplierService")
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    SupplierMapper supplierMapper;

    @Override
    public List<Supplier> getSupplierListByCodeAndName(String code, String name,Integer pageNo,Integer pageSize) {
        return supplierMapper.getSupplierListByCodeAndName ( code,name,(pageNo-1)*pageSize,pageSize );
    }

    @Override
    public int add(Supplier supplier) {
        return supplierMapper.add ( supplier );
    }

    @Override
    public int update(Supplier supplier) {
        return supplierMapper.update ( supplier );
    }

    @Override
    public int delete(List<Integer> ids) {
        return supplierMapper.delete ( ids );
    }

    @Override
    public Supplier getSupplierById(Integer id) {
        return supplierMapper.getSupplierById ( id );
    }

    @Override
    public int getCountByCodeAndName(String code, String name) {
        return supplierMapper.getCountByCodeAndName ( code,name );
    }

    @Override
    public int getCountByQueryJoinEntity(int id) {
        return supplierMapper.getCountByQueryJoinEntity ( id );
    }

    @Override
    public List<Supplier> getList() {
        return supplierMapper.getList ();
    }

}
